package CFun

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type A struct {
	Name string
}

func WithName(name string) func(a *A) {
	return func(a *A) {
		a.Name = name
	}
}

func Ajax(c *gin.Context, info ...func(a *A)) {

	detail := &A{
		Name: "请求成功",
	}

	for _, v := range info {
		v(detail)
	}

	c.AbortWithStatusJSON(http.StatusOK, detail)
}
